<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>contains</title>
</head>
<body>

    <div id="wrapper">
        <div id="main">
            <div id="content">
                
            </div>
        </div>
    </div>
    
    <script>

        /*
        contains 方法主要用于一个dom节点是否包含另一个dom节点
        */
        let wrapper = document.getElementById('wrapper');
        let main = document.getElementById('main');
        let content = document.getElementById('content');

        console.log(wrapper.contains(main)); // -> true
        console.log(content.contains(main)); // -> false
    </script>
</body>
</html>